build in the backend dir after auto-generating files
authorHans Breuer <hans@breuer.org>
Sat, 28 Jul 2001 23:02:02 +0000 (23:02 +0000)
committerHans Breuer <hans@src.gnome.org>
Sat, 28 Jul 2001 23:02:02 +0000 (23:02 +0000)
2001-07-29  Hans Breuer  <hans@breuer.org>

* gdk/makefile.msc : build in the backend dir after
auto-generating files

* gdk/win32/gdkfont-win32.c (gdk_font_load) : reimplement
with code from win32-production-branch.

*  gdk/win32/gdkwindow-win32.c : set the private->destroyed flag
before calling DestroyWindow, which indirectly calls
gdk_window_destroy_notify ()

(performance patch merged from win32-production-branch)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_segments):
Use PatBlt() instead of LineTo() when possible (solid single-pixel pen,
R2_COPYPEN rop). It is claimed to be much faster.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gdk/makefile.msc
gdk/win32/gdkdrawable-win32.c
gdk/win32/gdkfont-win32.c
gdk/win32/gdkwindow-win32.c

index b2a58fddf804259f9e07da1fc0d41f9b7198949a..e8f8700636928224aa3ebf2568edb5f25a9f6ab4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2001-07-29  Hans Breuer  <hans@breuer.org>
+
+       * gdk/makefile.msc : build in the backend dir after
+       auto-generating files
+
+       * gdk/win32/gdkfont-win32.c (gdk_font_load) : reimplement
+       with code from win32-production-branch.
+
+       *  gdk/win32/gdkwindow-win32.c : set the private->destroyed flag
+       before calling DestroyWindow, which indirectly calls 
+       gdk_window_destroy_notify ()
+
+       (performance patch merged from win32-production-branch)
+       * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_segments): 
+       Use PatBlt() instead of LineTo() when possible (solid single-pixel pen, 
+       R2_COPYPEN rop). It is claimed to be much faster.
+
 Fri Jul 27 11:31:15 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_property):
index b2a58fddf804259f9e07da1fc0d41f9b7198949a..e8f8700636928224aa3ebf2568edb5f25a9f6ab4 100644 (file)
@@ -1,3 +1,20 @@
+2001-07-29  Hans Breuer  <hans@breuer.org>
+
+       * gdk/makefile.msc : build in the backend dir after
+       auto-generating files
+
+       * gdk/win32/gdkfont-win32.c (gdk_font_load) : reimplement
+       with code from win32-production-branch.
+
+       *  gdk/win32/gdkwindow-win32.c : set the private->destroyed flag
+       before calling DestroyWindow, which indirectly calls 
+       gdk_window_destroy_notify ()
+
+       (performance patch merged from win32-production-branch)
+       * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_segments): 
+       Use PatBlt() instead of LineTo() when possible (solid single-pixel pen, 
+       R2_COPYPEN rop). It is claimed to be much faster.
+
 Fri Jul 27 11:31:15 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_property):
index b2a58fddf804259f9e07da1fc0d41f9b7198949a..e8f8700636928224aa3ebf2568edb5f25a9f6ab4 100644 (file)
@@ -1,3 +1,20 @@
+2001-07-29  Hans Breuer  <hans@breuer.org>
+
+       * gdk/makefile.msc : build in the backend dir after
+       auto-generating files
+
+       * gdk/win32/gdkfont-win32.c (gdk_font_load) : reimplement
+       with code from win32-production-branch.
+
+       *  gdk/win32/gdkwindow-win32.c : set the private->destroyed flag
+       before calling DestroyWindow, which indirectly calls 
+       gdk_window_destroy_notify ()
+
+       (performance patch merged from win32-production-branch)
+       * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_segments): 
+       Use PatBlt() instead of LineTo() when possible (solid single-pixel pen, 
+       R2_COPYPEN rop). It is claimed to be much faster.
+
 Fri Jul 27 11:31:15 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_property):
index b2a58fddf804259f9e07da1fc0d41f9b7198949a..e8f8700636928224aa3ebf2568edb5f25a9f6ab4 100644 (file)
@@ -1,3 +1,20 @@
+2001-07-29  Hans Breuer  <hans@breuer.org>
+
+       * gdk/makefile.msc : build in the backend dir after
+       auto-generating files
+
+       * gdk/win32/gdkfont-win32.c (gdk_font_load) : reimplement
+       with code from win32-production-branch.
+
+       *  gdk/win32/gdkwindow-win32.c : set the private->destroyed flag
+       before calling DestroyWindow, which indirectly calls 
+       gdk_window_destroy_notify ()
+
+       (performance patch merged from win32-production-branch)
+       * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_segments): 
+       Use PatBlt() instead of LineTo() when possible (solid single-pixel pen, 
+       R2_COPYPEN rop). It is claimed to be much faster.
+
 Fri Jul 27 11:31:15 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_property):
index b2a58fddf804259f9e07da1fc0d41f9b7198949a..e8f8700636928224aa3ebf2568edb5f25a9f6ab4 100644 (file)
@@ -1,3 +1,20 @@
+2001-07-29  Hans Breuer  <hans@breuer.org>
+
+       * gdk/makefile.msc : build in the backend dir after
+       auto-generating files
+
+       * gdk/win32/gdkfont-win32.c (gdk_font_load) : reimplement
+       with code from win32-production-branch.
+
+       *  gdk/win32/gdkwindow-win32.c : set the private->destroyed flag
+       before calling DestroyWindow, which indirectly calls 
+       gdk_window_destroy_notify ()
+
+       (performance patch merged from win32-production-branch)
+       * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_segments): 
+       Use PatBlt() instead of LineTo() when possible (solid single-pixel pen, 
+       R2_COPYPEN rop). It is claimed to be much faster.
+
 Fri Jul 27 11:31:15 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_property):
index b2a58fddf804259f9e07da1fc0d41f9b7198949a..e8f8700636928224aa3ebf2568edb5f25a9f6ab4 100644 (file)
@@ -1,3 +1,20 @@
+2001-07-29  Hans Breuer  <hans@breuer.org>
+
+       * gdk/makefile.msc : build in the backend dir after
+       auto-generating files
+
+       * gdk/win32/gdkfont-win32.c (gdk_font_load) : reimplement
+       with code from win32-production-branch.
+
+       *  gdk/win32/gdkwindow-win32.c : set the private->destroyed flag
+       before calling DestroyWindow, which indirectly calls 
+       gdk_window_destroy_notify ()
+
+       (performance patch merged from win32-production-branch)
+       * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_segments): 
+       Use PatBlt() instead of LineTo() when possible (solid single-pixel pen, 
+       R2_COPYPEN rop). It is claimed to be much faster.
+
 Fri Jul 27 11:31:15 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_property):
index b2a58fddf804259f9e07da1fc0d41f9b7198949a..e8f8700636928224aa3ebf2568edb5f25a9f6ab4 100644 (file)
@@ -1,3 +1,20 @@
+2001-07-29  Hans Breuer  <hans@breuer.org>
+
+       * gdk/makefile.msc : build in the backend dir after
+       auto-generating files
+
+       * gdk/win32/gdkfont-win32.c (gdk_font_load) : reimplement
+       with code from win32-production-branch.
+
+       *  gdk/win32/gdkwindow-win32.c : set the private->destroyed flag
+       before calling DestroyWindow, which indirectly calls 
+       gdk_window_destroy_notify ()
+
+       (performance patch merged from win32-production-branch)
+       * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_segments): 
+       Use PatBlt() instead of LineTo() when possible (solid single-pixel pen, 
+       R2_COPYPEN rop). It is claimed to be much faster.
+
 Fri Jul 27 11:31:15 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_property):
index 7866cd2455427c89e3716ac32119e88fa211778f..dd6c377fc6e411717711817b4be9bb912595f5db 100644 (file)
@@ -45,11 +45,17 @@ CFLAGS = -I . -I .. $(GLIB_CFLAGS) $(PANGO_CFLAGS) -I ../gdk-pixbuf \
 EXTRALIBS = $(WTKIT)\lib\i386\wntab32x.lib $(GLIB_LIBS) \
                ..\gdk-pixbuf\gdk_pixbuf-$(GDK_PIXBUF_VER).lib $(PANGOWIN32_LIBS)
 
+gdk-win32-backend :
+       cd win32
+       nmake -nologo -f makefile.msc
+       cd ..
+       
 all: \
        ..\config.h \
        gdkconfig.h \
        gdkenumtypes.h \
        gdkenumtypes.c \
+       gdk-win32-backend \
        gdk-win32-$(GTK_VER).dll \
        testgdk.exe
 
index 2554ec365dbdc20777fd416f63d932c3a20c81cf..8910965fddea1312c77d5ee890bc07784fa92cd2 100644 (file)
@@ -867,17 +867,56 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
     }
   else
     {
+      const gboolean maybe_patblt =
+       gc_private->rop2 == R2_COPYPEN &&
+       gc_private->pen_width <= 1 &&
+       (gc_private->pen_style & PS_STYLE_MASK) == PS_SOLID;
+
       for (i = 0; ok && i < nsegs; i++)
        {
-         if (!MoveToEx (hdc, segs[i].x1, segs[i].y1, NULL))
-           WIN32_GDI_FAILED ("MoveToEx"), ok = FALSE;
-         if (ok && !LineTo (hdc, segs[i].x2, segs[i].y2))
-           WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
+         /* PatBlt() is much faster than LineTo(), says
+           * jpe@archaeopteryx.com. Hmm. Use it if we have a solid
+           * colour pen, then we know that the brush is also solid and
+           * of the same colour.
+          */
+         if (maybe_patblt && segs[i].x1 == segs[i].x2)
+            {
+             int y1, y2;
+
+             if (segs[i].y1 <= segs[i].y2)
+               y1 = segs[i].y1, y2 = segs[i].y2;
+             else
+               y1 = segs[i].y2, y2 = segs[i].y1;
+
+              if (!PatBlt (hdc, segs[i].x1, y1,
+                          1, y2 - y1 + 1, PATCOPY))
+                WIN32_GDI_FAILED ("PatBlt"), ok = FALSE;
+            }
+         else if (maybe_patblt && segs[i].y1 == segs[i].y2)
+            {
+             int x1, x2;
+
+             if (segs[i].x1 <= segs[i].x2)
+               x1 = segs[i].x1, x2 = segs[i].x2;
+             else
+               x1 = segs[i].x2, x2 = segs[i].x1;
+
+              if (!PatBlt (hdc, x1, segs[i].y1,
+                          x2 - x1 + 1, 1, PATCOPY))
+                WIN32_GDI_FAILED ("PatBlt"), ok = FALSE;
+            }
+          else
+            {
+             if (!MoveToEx (hdc, segs[i].x1, segs[i].y1, NULL))
+               WIN32_GDI_FAILED ("MoveToEx"), ok = FALSE;
+             if (ok && !LineTo (hdc, segs[i].x2, segs[i].y2))
+               WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
          
-         /* Draw end pixel */
-         if (ok && gc_private->pen_width <= 1)
-           if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2))
-             WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
+             /* Draw end pixel */
+             if (ok && gc_private->pen_width <= 1)
+               if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2))
+                 WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
+            }
        }
     }
   gdk_win32_hdc_release (drawable, gc, mask);
index 69c893f0228cef43a961ef85833df6c4c966e661..30f338859304926cea0c38634a7fa5820b4a4cf3 100644 (file)
@@ -1517,6 +1517,11 @@ GdkFont*
 gdk_font_load (const gchar *font_name)
 {
   GdkFont *font;
+  GdkFontPrivateWin32 *private;
+  GdkWin32SingleFont *singlefont;
+  HGDIOBJ oldfont;
+  HANDLE *f;
+  TEXTMETRIC textmetric;
 
   g_return_val_if_fail (font_name != NULL, NULL);
 
@@ -1524,6 +1529,29 @@ gdk_font_load (const gchar *font_name)
   if (font)
     return font;
 
+  private = g_new (GdkFontPrivateWin32, 1);
+  font = (GdkFont*) private;
+
+  singlefont = gdk_font_load_internal (font_name);
+
+  private->base.ref_count = 1;
+  private->names = NULL;
+  private->fonts = g_slist_append (NULL, singlefont);
+
+  /* Pretend all fonts are fontsets... Gtktext and gtkentry work better
+   * that way, they use wide chars, which is necessary for non-ASCII
+   * chars to work. (Yes, even Latin-1, as we use Unicode internally.)
+   */
+  font->type = GDK_FONT_FONTSET;
+  oldfont = SelectObject (gdk_display_hdc, singlefont->hfont);
+  GetTextMetrics (gdk_display_hdc, &textmetric);
+  SelectObject (gdk_display_hdc, oldfont);
+  font->ascent = textmetric.tmAscent;
+  font->descent = textmetric.tmDescent;
+
+  GDK_NOTE (MISC, g_print ("... asc %d desc %d\n",
+                          font->ascent, font->descent));
+
   gdk_font_hash_insert (GDK_FONT_FONTSET, font, font_name);
 
   return gdk_font_from_one_singlefont (gdk_font_load_internal (font_name));
index c6205b8350502814e33dd81032485d2fc421e4a6..afa5e86a7bac0f1711fbc8ccebc4d614f5eab7d4 100644 (file)
@@ -770,7 +770,10 @@ _gdk_windowing_window_destroy (GdkWindow *window,
        }
     }
   else if (!recursing && !foreign_destroy)
-    DestroyWindow (GDK_WINDOW_HWND (window));
+    {
+      private->destroyed = TRUE;
+      DestroyWindow (GDK_WINDOW_HWND (window));
+    }
 }
 
 /* This function is called when the window really gone.